CREATE TABLE [dbo].[tb_ExamenesMedicos]
(
[IdExamenMedico] [int] NOT NULL IDENTITY(1, 1),
[Agente] [int] NOT NULL,
[Causa] [int] NOT NULL,
[DescripcionCausa] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Tipo] [int] NOT NULL,
[ZonaSaludLaboral] [int] NULL,
[Prestadora] [int] NULL,
[FechaYHora] [datetime] NULL,
[LugarExamen] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Medico] [int] NULL,
[Dictamen] [int] NULL,
[AvalNormativo] [int] NULL,
[Diagnostico] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_ExamenesMedicos] ADD CONSTRAINT [PK_tb_ExamenesMedicos] PRIMARY KEY NONCLUSTERED  ([IdExamenMedico]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_ExamenesMedicos] WITH NOCHECK ADD CONSTRAINT [FK_tb_ExamenesMedicos_tb_Agentes] FOREIGN KEY ([Agente]) REFERENCES [dbo].[tb_Agentes] ([idAgente])
GO
ALTER TABLE [dbo].[tb_ExamenesMedicos] WITH NOCHECK ADD CONSTRAINT [FK_tb_ExamenesMedicos_tb_Licencias] FOREIGN KEY ([AvalNormativo]) REFERENCES [dbo].[tb_Licencias] ([idLicencia])
GO
ALTER TABLE [dbo].[tb_ExamenesMedicos] ADD CONSTRAINT [FK_tb_ExamenesMedicos_tb_CausaDeExamen] FOREIGN KEY ([Causa]) REFERENCES [dbo].[tb_CausaDeExamen] ([idCausaExamen])
GO
ALTER TABLE [dbo].[tb_ExamenesMedicos] WITH NOCHECK ADD CONSTRAINT [FK_tb_ExamenesMedicos_tb_Enfermedades] FOREIGN KEY ([Diagnostico]) REFERENCES [dbo].[tb_Enfermedades] ([idEnfermedad])
GO
ALTER TABLE [dbo].[tb_ExamenesMedicos] ADD CONSTRAINT [FK_tb_ExamenesMedicos_tb_DictamenDeExamen] FOREIGN KEY ([Dictamen]) REFERENCES [dbo].[tb_DictamenDeExamen] ([idDictamenExamen])
GO
ALTER TABLE [dbo].[tb_ExamenesMedicos] ADD CONSTRAINT [FK_tb_ExamenesMedicos_tb_Medicos] FOREIGN KEY ([Medico]) REFERENCES [dbo].[tb_Medicos] ([idMedico])
GO
ALTER TABLE [dbo].[tb_ExamenesMedicos] ADD CONSTRAINT [FK_tb_ExamenesMedicos_tb_PrestadoresDeSaludLaboral] FOREIGN KEY ([Prestadora]) REFERENCES [dbo].[tb_PrestadoresDeSaludLaboral] ([IdPrestador])
GO
ALTER TABLE [dbo].[tb_ExamenesMedicos] ADD CONSTRAINT [FK_tb_ExamenesMedicos_tb_TiposDeExamenMedico] FOREIGN KEY ([Tipo]) REFERENCES [dbo].[tb_TiposDeExamenMedico] ([idTipoExamenMedico])
GO
ALTER TABLE [dbo].[tb_ExamenesMedicos] ADD CONSTRAINT [FK_tb_ExamenesMedicos_tb_ZonasDeSaludLaboral] FOREIGN KEY ([ZonaSaludLaboral]) REFERENCES [dbo].[tb_ZonasDeSaludLaboral] ([idZonaSalud])
GO
